/**
 * 
 */
package com.example.envatoandroid.db;

import android.content.Context;

/**
 * @author niam
 *
 */
public class UserInfoDataManager
{
	private static UserInfoDataManager instance = null;
	
	private UserInfoDatabase db;
	
	private UserInfoDataManager(Context context)
	{
		db = UserInfoDatabase.getInstance(context);
	}
	
	public static UserInfoDataManager getInstance(Context context)
	{
		if (instance == null)
		{
			instance = new UserInfoDataManager(context);
		}
		return instance;
	}
	
	public void open()
	{
		db.open();
	}
	
	public void close()
	{
		db.close();
	}
	
	public long inserUserInfoData(UserInfoData userInfoData)
	{
//		open();
		return db.insert(userInfoData);
//		close();
	}
	
	public UserInfoData getUserInfoData()
	{
		UserInfoData userInfoData = UserInfoData.getInstance();
		
//		open();
		userInfoData = db.getData(userInfoData.getUserName());
//		close();
		
		return userInfoData;
	}
}
